package com.lt.work;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * work模式，一个生产者发送过来的消息，被两个消费者其中一个消费
 * @author lucine
 * @version 1.0 2021/6/20 14:38
 */
@Component
public class WorkCustomer {

    /**
     *  消费者1
     */
    @RabbitListener(queuesToDeclare = @Queue(value = "work"))
    public void receive1(String message){
        System.out.println("message1  = "+message);
    }
    /**
     *  消费者2
     */
    @RabbitListener(queuesToDeclare = @Queue(value = "work"))
    public void receive2(String message){
        System.out.println("message2  = "+message);
    }

}
